<html>
<head><meta charset="utf-8"><title>Per query memory usage is quadratic again? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Per.20query.20memory.20usage.20is.20quadratic.20again.3F.html">Per query memory usage is quadratic again?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243421122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Per%20query%20memory%20usage%20is%20quadratic%20again%3F/near/243421122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Per.20query.20memory.20usage.20is.20quadratic.20again.3F.html#243421122">(Jun 21 2021 at 18:10)</a>:</h4>
<p><span class="user-mention" data-user-id="129457">@Florian Diebold</span> I've re-run <code>env RUN_SLOW_BENCHES=1 cargo test --release --package rust-analyzer --lib -- integrated_benchmarks::integrated_highlighting_benchmark --exact --nocapture</code> today, and I got this output:</p>
<div class="codehilite"><pre><span></span><code>running 1 test
workspace loading: 4.85s
initial: 5.74s
change: 10.14µs
cpu profiling is disabled, uncomment `default = [ &quot;cpu_profiler&quot; ]` in Cargo.toml to enable.
  414ms - highlight
      288ms - infer:wait @ per_query_memory_usage
          288ms - infer_query
                1ms - crate_def_map:wait (14538 calls)
                4ms - deref (3410 calls)
                0ms - generic_params_query (1 calls)
              171ms - resolve_obligations_as_possible (19020 calls)
                1ms - trait_solve::wait (3807 calls)
              109ms - ???
       10ms - Semantics::analyze_impl (64 calls)
        0ms - SourceBinder::to_module_def (36 calls)
       71ms - classify_name (37 calls)
       12ms - classify_name_ref (382 calls)
        0ms - crate_def_map:wait (265 calls)
        8ms - descend_into_macros (642 calls)
        0ms - impl_data_query (1 calls)
       20ms - infer:wait (76 calls)
        0ms - parse_macro_expansion (3 calls)
        0ms - source_file_to_def (1 calls)
        0ms - trait_solve::wait (83 calls)
after change: 416.13ms
</code></pre></div>
<p>Seems like we again process obligations quadratically?</p>



<a name="243421250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Per%20query%20memory%20usage%20is%20quadratic%20again%3F/near/243421250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Per.20query.20memory.20usage.20is.20quadratic.20again.3F.html#243421250">(Jun 21 2021 at 18:11)</a>:</h4>
<p>there is a certain quadraticness expected, yes</p>



<a name="243421287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Per%20query%20memory%20usage%20is%20quadratic%20again%3F/near/243421287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Per.20query.20memory.20usage.20is.20quadratic.20again.3F.html#243421287">(Jun 21 2021 at 18:11)</a>:</h4>
<p>the quadratic part shouldn't be large though</p>



<a name="243421432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Per%20query%20memory%20usage%20is%20quadratic%20again%3F/near/243421432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Per.20query.20memory.20usage.20is.20quadratic.20again.3F.html#243421432">(Jun 21 2021 at 18:12)</a>:</h4>
<p>It looks like it adds up to quarter of a second with <code>--release</code>, so it maybe make sense to optimize this somewhat</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>